#-*- coding:utf-8 -*-

from django.db import models
from django.contrib.auth.models import User
from mcom.settings import MEDIA_ROOT


class InfoData(models.Model):
    publisher = models.ForeignKey(User)
    typeid = models.PositiveIntegerField()
    title = models.CharField(max_length=100)
    images = models.CharField(max_length=128) #image id
    content = models.CharField(max_length=2048)
    detail = models.CharField(max_length=2048) # A json type data 
    issettop = models.BooleanField(default=False)
    lastupdate = models.DateTimeField(auto_now=True)
    flushtimes = models.PositiveIntegerField(default=0)

    def __unicode__(self):
        return self.title


class InfoPic(models.Model):
    infoid = models.PositiveIntegerField()
    pic = models.ImageField(upload_to="user", null=True, blank=True)


